<?php defined( 'BASEPATH' ) or die( 'Restricted' );

/*
This code is copyright 2009-2010 by TMLA INC.  ALL RIGHTS RESERVED.
Please view license.txt in /tgsf_core/legal/license.txt or
http://tgWebSolutions.com/opensource/tgsf/license.txt
for complete licensing information.
*/

class new_link_form extends tgsfForm
{
	//------------------------------------------------------------------------
	/**
	*
	*/
	protected function _setup()
	{
		$this->id( 'new-link-form' );
		
		$this->useTemplate( 'top' );
		$this->_( fftText	)->caption( '*URL' )->name( 'link_url' );
		$this->_( fftTextArea	)->caption( 'Description'	)->name( 'link_desc');
		
		$this->_( fftText )
			->caption( 'Tag(s)' )
			->name( 'link_tags' )
			->desc( 'Separate tags with commas');

		$this->startGroup( '_buttons' );
		$this->_( fftSubmit		)->caption( 'Save'	)->name( 'go' );

		$this->_( fftButton )
			->caption( 'Cancel' )
			->name( 'cancel' )
			->setFieldAttribute( 'type', 'button' );
//			->setFieldAttribute( 'onclick', "alert( 'blah' );" ); //return tgsf.URL( '' ).redirect();" );
	}

	//------------------------------------------------------------------------

	protected function _setupValidate( &$v )
	{
		$v->_( 'link_url'	)->required()->max_len( 512 ); // need to implement xss validation
		$v->_( 'link_tags'	)->required()->clean()->max_len( 4096 );
		$v->_( 'link_desc'	)->max_len( 500 );
	}
}

return new new_link_form();